﻿using BacklogParser.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;

namespace BacklogParser.Parsers
{
    public static class DesignationOfStateParser
    {
        public static List<DesignationOfStates> Parse(List<XElement> states)
        {
            var result = new List<DesignationOfStates>();
            foreach (var item in states)
            {
                var countriesList = item.Descendants(Constants.Epo + "country").ToList().Select(x => x.Value);
                var countries = string.Join(" ", countriesList);
                result.Add(new DesignationOfStates { ICIREPATCountries = countries });
            }

            return result;
        }
    }
}
